package com.xxwy.springcloud.controller;

import com.xxwy.springcloud.entity.Dept;
import com.xxwy.springcloud.service.DeptClientService;
import com.xxwy.springcloud.service.DeptClientServiceFallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author xxwy
 * on 2018/9/30 0030
 */
@RestController
@RequestMapping("feign")
public class DeptConrtoller_Feign {

    @Autowired
    DeptClientService deptClientService;


    @PostMapping("dept/add")
    public boolean add(@RequestBody Dept dept) {
        return deptClientService.add(dept);
    }

    @GetMapping("dept/get/{id}")
    public Dept get(@PathVariable("id")Integer id){
        return deptClientService.get(id);
    }

    @GetMapping("dept/list")
    public List<Dept> getlist(){
        return deptClientService.list();
    }
}
